package org.example.frame;
import javax.swing.*;
import java.awt.*;
import org.example.model.*;
import org.example.panel.*;
import org.example.panel.coursepanel.*;

/**
 * @author lenovo
 */

public class CourseFrame extends JFrame{
    public CourseFrame(User user){
        //组件准备
        JTabbedPane tabbedPane = new JTabbedPane();
        AddCoursePanel addCourse = new AddCoursePanel();
        DeleteCoursePanel deleteCourse = new DeleteCoursePanel();
        SearchCoursePanel searchCourse = new SearchCoursePanel();
        ReturnFramePanel returnFrame = new ReturnFramePanel(user,this);
        //添加组件
        tabbedPane.add("添加课程",addCourse);
        tabbedPane.add("删除课程",deleteCourse);
        tabbedPane.add("查找课程",searchCourse);
        tabbedPane.add("返回界面",returnFrame);
        add(new JLabel("当前用户用户名："+user.getUsername()), BorderLayout.NORTH);
        add(tabbedPane,BorderLayout.CENTER);
        //窗口设置
        setTitle("学生成绩管理->课程管理");
        setSize(500,400);
        setLocationRelativeTo(null);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        validate();
    }
}
